package com.etc.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
public class CodeMessage {
    private String token;
    private String code;
    private String message;
    private Object data;

    public CodeMessage(String code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public CodeMessage() {
    }

    public static CodeMessage success(Object data) {
        return new CodeMessage("20000", "success", data);
    }

    public static CodeMessage message(String s, Object o) {
        CodeMessage cm = new CodeMessage();
        cm.setCode("20001");
        cm.setData(o);
        cm.setMessage(s);
        return cm;
    }
}
